package com.atguigu.day11.exer.e2;

import java.util.Scanner;

/**
 * @version 1.0
 * @Author 马冰
 * @Date 2024/11/12 13:53
 * @注释
 */
public class Test {
    public static void main(String[] args) {

        SalaryEmployee s1 = new SalaryEmployee("张三-正式工", 5000, new MyDate(2000, 11, 20));
        HourEmployee h1 = new HourEmployee("李四-小时工", 100, 10);
        Manager m1 = new Manager("悟空-经理", 10000, new MyDate(1999, 5, 20), 0.5);
        Employee[] emp = {s1, h1, m1};
        double sum = 0;

        for (Employee e : emp) {
            System.out.println(e);
            sum += e.earning();
        }
        System.out.println("通知财务准备工资：" + sum);

        System.out.println("-----------------------------------");

        Scanner input = new Scanner(System.in);
        System.out.println("请输入查询月份：");
        int month = input.nextInt();
        for (Employee e : emp) {
            if (e instanceof SalaryEmployee s) {
                //SalaryEmployee s = (SalaryEmployee)e;
                if (s.getMyDates().getMonth() == month) {
                    System.out.println("恭喜你 " + s.getName() + " 生日快乐 请来前台领取你的生日礼物");
                }
            }
        }

    }
}
